package edu.xcdq;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;

public class ServletDemo01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("get请求被调用了");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("post请求被调用了");
    }

    @Override
    public void destroy() {
        System.out.println("destroy被调用了");
        super.destroy();
    }

    @Override
    public ServletConfig getServletConfig() {
        System.out.println("config被调用了");
        return super.getServletConfig();
    }

    @Override
    public String getServletInfo() {
        System.out.println("getServletInfo被调用了");
        return super.getServletInfo();
    }

    @Override
    public void init() throws ServletException {

        System.out.println("init被调用了");
        super.init();
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        String charSetContent = config.getInitParameter("charSetContent");
        System.out.println(charSetContent);
        super.init(config);
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("service被调用了");
        super.service(req, resp);
    }

}
